class TestimonialsController < ApplicationController

	def index
		@testimonials = Testimonial.all
	end

	def new
		@testimonial = Testimonial.new
	end

	def create
		@testimonial = Testimonial.new(params[:testimonial])
		if @testimonial.save
			flash[:notice] = "Testimonial Created $green"
			redirect_to :action => "index"
		else
			render "new"
		end
	end
	
	def delete
		@testimonial = Testimonial.find(params[:id])
	end
	
	def destroy
		@testimonial = Testimonial.find(params[:id])

		if @testimonial.destroy
			flash[:notice] = "testimonial Deleted $blue"
			redirect_to(:action =>  "index")
		else
			flash[:notice] = "Couldn't delete testimonial $red"
		end
	end
		
		
	def edit
		@testimonial = Testimonial.find(params[:id])
	end
	
	def update
		@testimonial = Testimonial.find(params[:id])
		if @testimonial.update_attributes(params[:testimonial])
			redirect_to :action => "index"
		else
			render "edit"
		end
	end	
	
end
